#include<iostream>
#include<ctime>

float speed = 0;//单位rad/s
float omega = 0, a = 0, b = 0;
omega =  ((1 + rand() % 116)/100) + 1.884 ;
a = ((1 + rand() % 265)/1000) + 0.78;
b = 2.09 - a;
int stage=1;
//stage == 1 小能量机关模式 stage == 2 大能量机关模式

double motor_speed()
{
  double t = 0;
  std::time_t t = std::time(0);
  if(stage == 1)
  {
    speed = 10;
  }
  else if(stage == 2)
  {
    t = std::time(0) - t;
    speed =  a * sin(omega * t ) + b;
  }
  
  return speed;
}